﻿using System;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Collections;
using System.Drawing;
using System.Linq;
using System.Workflow.ComponentModel;
using System.Workflow.ComponentModel.Design;
using System.Workflow.ComponentModel.Compiler;
using System.Workflow.ComponentModel.Serialization;
using System.Workflow.Runtime;
using System.Workflow.Activities;
using System.Workflow.Activities.Rules;
using WfActivityLibrary.control;
using System.Drawing.Design;
using CommonLibrary.DataModel.Basic;
using System.Collections.Generic;
using CommonLibrary.DataModel.WorkFlow;

namespace WfActivityLibrary
{

    [ActivityValidator(typeof(通知Validator))]
    public partial class 通知 : CallExternalMethodActivity
    {
        public 通知()
        {
            InitializeComponent();
        }

        #region 属性
        public static DependencyProperty 任务名Property = DependencyProperty.Register("任务名", typeof(string), typeof(通知));
        [DescriptionAttribute("任务名")]
        [CategoryAttribute("任务名 Category")]
        [BrowsableAttribute(true)]
        [DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Visible)]
        public string 任务名
        {
            get
            {
                return ((string)(base.GetValue(通知.任务名Property)));
            }
            set
            {
                base.SetValue(通知.任务名Property, value);
            }
        }

        public static DependencyProperty 处理人Property = DependencyProperty.Register("处理人", typeof(ChoiceClrxx), typeof(通知));
        [DescriptionAttribute("处理人")]
        [CategoryAttribute("处理人 Category")]
        [BrowsableAttribute(true)]
        [DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Visible)]
        public ChoiceClrxx 处理人
        {
            get
            {
                return ((ChoiceClrxx)(base.GetValue(通知.处理人Property)));
            }
            set
            {
                base.SetValue(通知.处理人Property, value);
            }
        }
        #endregion

        #region 事件

        private void 通知_MethodInvoking(object sender, EventArgs e)
        {
            Activity temp = this;
            while (temp.Parent != null)
            {
                temp = temp.Parent;
            }
            if (temp != null && temp is BaseStateWorkflow)
            {
                this.ParameterBindings["instanceID"].Value = this.WorkflowInstanceId;
                this.ParameterBindings["fqrxx"].Value = (temp as BaseStateWorkflow).创建者;
                this.ParameterBindings["clrxx"].Value = 处理人 = (temp as BaseStateWorkflow).下一步处理人;
                this.ParameterBindings["taskName"].Value = this.任务名;
                this.ParameterBindings["wivList"].Value = (temp as BaseStateWorkflow).insValue;
            }
            else if (temp != null && temp is BaseSequenceWorkflow)
            {
                this.ParameterBindings["instanceID"].Value = this.WorkflowInstanceId;
                this.ParameterBindings["fqrxx"].Value = (temp as BaseSequenceWorkflow).创建者;
                this.ParameterBindings["clrxx"].Value = 处理人 = (temp as BaseSequenceWorkflow).下一步处理人;
                this.ParameterBindings["taskName"].Value = this.任务名;
                this.ParameterBindings["wivList"].Value = (temp as BaseStateWorkflow).insValue;
            }
        }

        #endregion
    }
}
